
if __name__ == '__main__':
    nums1 = [1, 2, 3, 0, 0, 0]
    m = 3
    nums2 = [2, 5, 6]
    n = 3
    max1 = max(nums1)
    max2 = max(nums2)
    numl=[0 for i in range(m+n)]
    if max1 >= max2:
        maxl = max1
    else:
        maxl = max2

    print(maxl)
    flag=0
    for i in range(1,maxl+1):
        if (i in nums1)&(i in nums2):
            numl[flag] = i
            numl[flag + 1] = i
            flag = flag + 2
        elif (i in nums1) | (i in nums2):
            numl[flag] = i
            flag+=1
        else:
            continue
    nums1=numl
    print(nums1)